# 使用json.dump()方法将该Python字典对象转换为JSON格式的字符串，并将其写入到文件中

# python 字典对象
data = {
    "name": "John Smith",
    "age": 30,
    "city": "New York",
    "languages": ["English", "Spanish", "French"],
    "isMarried": True,
    "education": {
        "degree": "Master's Degree",
        "school": "New York University"
    }
}

# 代码
import json

json_str = json.dumps(data)

# 将JSON格式的字符串写入文件
with open('data.json', 'w') as f:
    json.dump(data, f)